#import <Foundation/Foundation.h>

@interface Foo: NSObject
{
    int x;
}
@end

@implementation Foo
@end

int main (int argc, char *argv[])
{
    NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
    Foo   *myFoo = [[Foo alloc] init];

    NSLog (@"Liczba referencji do obiektu myFoo = %lx",
                      (unsigned long) [myFoo retainCount]);

    [pool drain];
    NSLog (@"Po oprnieniu puli  = %lx", (unsigned long) [myFoo retainCount]);

    pool = [[NSAutoreleasePool alloc] init];
    [myFoo autorelease];
    NSLog (@"Po dodaniu do puli automatycznej = %lx",
                       (unsigned long) [myFoo retainCount]);

    [myFoo retain];
    NSLog (@"Po wywoaniu metody retain = %lx", (unsigned long) [myFoo retainCount]);

    [pool drain];
    NSLog (@"Po drugim oprnieniu puli = %lx",
                       (unsigned long) [myFoo retainCount]);

    [myFoo release];
    return 0;
}